/**
 * 
 */
package com.angel.configuration.initializer.impl;

import com.angel.architecture.persistence.beans.ConfigurationParameter;
import com.angel.common.helpers.ReflectionHelper;
import com.angel.configuration.initializer.ConfigurationInitializer;
import com.angel.io.processors.commands.imports.ImportFileProcessorCommand;
import com.angel.webapp.application.ApplicationImportFileCommands;

/**
 * @author William
 *
 */
public class ImportStrategiesInitializer extends ConfigurationInitializer{

	private static final String IMPORT_STRATEGIES_AREA_NAME = "ImportsStrategies";

	@Override
	public boolean appliesConfiguration(ConfigurationParameter cp) {
		return cp != null && cp.isForParameterArea(IMPORT_STRATEGIES_AREA_NAME);
	}

	@Override
	public void addConfiguration(ConfigurationParameter cp) {
		ImportFileProcessorCommand importFileProcessorCommand = (ImportFileProcessorCommand) ReflectionHelper.createObject(cp.getStringValue());
		ApplicationImportFileCommands.createInstance().addImportFileCommand(cp.getName(), importFileProcessorCommand);
	}
}
